package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.BidAgencyDao;
import com.chinasi.model.AgencyBasic;
import com.chinasi.model.BidAgency;
import com.chinasi.model.ConsumerBasic;
import com.chinasi.service.BidAgencyService;

@Service
public class BidAgencyServiceImpl implements BidAgencyService {

	/**
	 * BidAgencyDAO
	 */
	@Autowired
	private BidAgencyDao bidAgencyDao;
	
	@Override
	public Pager findRelationBid(String agCode, int currentPage) {
		BidAgency searchBean = new BidAgency();
		searchBean.setAgCode(agCode);
		Pager pager = new Pager(bidAgencyDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidAgencyDao.findRelationBid(searchBean, pager));
		return pager;
	}
	
	@Override
	public Pager findRelationConsult(AgencyBasic agency, int currentPage) {
		Pager pager = new Pager(bidAgencyDao.getRelationConsultTotalCount(agency),currentPage);
		pager.setData(bidAgencyDao.findRelationConsult(agency,pager));
		return pager;
	}

	@Override
	public Pager findRelationIntegrator(AgencyBasic agency, int currentPage) {
		Pager pager = new Pager(bidAgencyDao.getRelationIntegratorTotalCount(agency),currentPage);
		pager.setData(bidAgencyDao.findRelationIntegrator(agency,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsumer(AgencyBasic agency, int currentPage) {
		Pager pager = new Pager(bidAgencyDao.getRelationConsumerTotalCount(agency),currentPage);
		pager.setData(bidAgencyDao.findRelationConsumer(agency,pager));
		return pager;
	}

	@Override
	public Pager findRelationSupervision(AgencyBasic agency, int currentPage) {
		Pager pager = new Pager(bidAgencyDao.getRelationSupervisionTotalCount(agency),currentPage);
		pager.setData(bidAgencyDao.findRelationSupervision(agency,pager));
		return pager;
	}

	@Override
	public Pager findRelationExpert(AgencyBasic agency, int currentPage) {
		Pager pager = new Pager(bidAgencyDao.getRelationExpertTotalCount(agency),currentPage);
		pager.setData(bidAgencyDao.findRelationExpert(agency,pager));
		return pager;
	}
}
